<?php

namespace app\api\controller\shop;

use app\store\controller\Controller;
use app\store\model\store\Shop as ShopModel;
use app\store\model\store\shop\Coach as CoachModel;
use think\Db;

/**
 * 门店教练控制器
 * Class Clerk
 * @package app\store\controller\shop
 */
class Coach extends Controller
{

    /**
     * @param int $shop_id
     * @param string $search
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function index($shop_id = 0, $search = '')
    {
        $model = new CoachModel();
        // 教练列表
        $list = $model->getList(-1, $shop_id, $search);
        return $this->renderSuccess(compact('list'));
    }


    /**
     * // 门店列表
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function shopList(){
        $shop_id = $this->store['user']['shop_user_id'];
        $where=[];
        if ($shop_id){
            $where['shop_id']=$shop_id;
        }
        return ShopModel::getAllList($where);
    }

}